/**
*
*
***/
;
(function(){
	'use strict';
	var app = angular.module('fwa.services');
	app.service('WarningAddService',['$http','Modal','BaseURL', function ($http,Modal,baseUrl) {
	    var serv = this;
//		serv.medicalOrgInfoList = {};
	    var mark = 0;//扣分 mark：1.机构扣分，2.医务人员扣分，3参保人员扣分
	    var warningMarkData = {};//扣分所需参数数据
	    var  warningMarks = [];//扣分信息列表
	    var warningMarkTemps = [{
			deducitonMedicals:[],//医疗机构
			deducitonStaffs:[],//医护人员
			deducitonInsurs:[],//参保人员
			deductionDeletes:[]//删除过已存库的数据
			}];
		serv.getHcpmsCodeList=function(codeType){
		return 	$http({
		    	 method: "get",
		    	 url:baseUrl+'hcpmsWarning/getCodeList.do',
		    	 params:{
		    		 codeType:codeType
		    	 }
			});
		 }
		//获取预警编号
		serv.getWarnNoticeNum = function(handMethod,warnBusiness){
			return 	$http({
		    	 method: "post",
		    	 url:baseUrl+'hcpmsWarning/createWarnNoticeNum.do',
		    	 params:{
		    		 handMethod: handMethod,
		    		 warnBusiness: warnBusiness
		    	 }
			});
		 }
		/**获取机构列表**/
        serv.initMedicalOrgInfoList = function(){
			$http({
		    	 method: "get",
		    	 url:baseUrl+'community/getNewMedicalOrgInfoList.do'
			}).success(function(response, status, headers, config){
				serv.medicalOrgInfoList = response.medicalOrgList;
			});
        };
        
		//获取当前日期
	     serv.getCurrentDate = function(){
	    	 var d = new Date();
	    	 var year = d.getFullYear();
	    	 var month = d.getMonth()+1;
	    	 var day = d.getDate();
	    	 month = month < 10 ? ("0" + month) : month;
	    	 return year + "-" + month + "-" + day;	
	     }
	        
		//获取当前日期+5
	     serv.getNextWeekDate = function(){
	    	 var d = new Date();
	    	 var year = d.getFullYear();
	    	 var month = d.getMonth()+1;
	    	 var day = d.getDate()+5;
	    	 month = month < 10 ? ("0" + month) : month;
	    	 return year + "-" + month + "-" + day;	
	     }

		serv.setPriodDate = function(start,end){
			var date="";
			var reg=new RegExp("-","g");
			if(start){
				date=date+start.replace(reg,"");
			}
			date+=' - ';
			if(end){
				date=date+end.replace(reg,"");
			}
			return date;
		}
		//保存预警事件
	     serv.saveHcpmsWarning = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/saveWarning.do',params);
	     }
	     //提交审批预警事件
	     serv.submitWarnProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/submitWarnProcess.do',params);
	     }
		 //审核预警事件
	     serv.auditWarnProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/auditWarnProcess.do',params);
	     }
	     
	     //自查结果评估
	     serv.assessWarnProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/assessResultWarin.do',params);
	     }
	     //自查结论审核
	     serv.resultAuditProcess = function (params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/resultAuditProcess.do',params);
	     }
	     //预警审批
	     serv.approveWarnProcess = function (params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/warnApproveAudit.do',params);
	     }
	     //---------------------------------------------------------------------------
	     //预警的批量审批
	     serv.approveWarnsps=function(params){
	    	// Modal.alert("路径："+baseUrl);
	    	 return $http.post(baseUrl + 'hcpmsWarning/warnApproveWarnsps.do',params);
	     }
	    //---------------------------------------------------------------------------
	     
	     //查询医疗机构
	     serv.getWarningMedicalList = function(params) {
				return $http({
					url:baseUrl+'hcpmsWarning/getMedicalList.do',
					method:'GET',
					params : params
				});
		 }
	     //查询医务人员
		serv.getWarningStaffList = function(params) {
			return $http({
				url:baseUrl+'hcpmsWarning/getStaffList.do',
				method:'GET',
				params : params
			});
		}
		//查询参保人员
		serv.getWarningInsurList = function(params) {
			return $http({
				url:baseUrl+'hcpmsWarning/getInsuranceList.do',
				method:'GET',
				params : params
			});
		}
	     //查询监控类型
	     serv.getWarnMonitorList = function() {
				return $http({
					url:baseUrl+'warnResult/warnMonitor.do',
					method:'GET'});
		 }
	     //规则名称
		 serv.getWarnRuleList = function() {
			 return $http({
				url:baseUrl+'warnResult/warnMonitorRule.do',
				method:'GET'
			});
		}
		//查询预警事件
	     serv.getHcpmsWarning=function(param){
           return  $http({
		    	  method: "GET",
		    	  url:baseUrl+'hcpmsWarning/queryWarnData.do',
		    	  params:param
		     }); 
	     }
		//查询网上筛查
	     serv.getWarningScreen = function(params){
	    	 return $http({
		    	  method: "get",
		    	  url:baseUrl+'hcpmsWarning/queryWarnScreen.do',
		    	  params:params
		     }); 
	     }
	     //自查结果查询
	     serv.getWarnCheckResult = function(params) {
				return $http({
					url:baseUrl+'hcpmsWarning/getFeedBackList.do',
					method:'GET',
					params : params
				});
			}
	   //查询结论评估
	     serv.getWarnResult = function(params){
	    	 return $http({
		    	  method: "get",
		    	  url:baseUrl+'hcpmsWarning/getWarnResult.do',
		    	  params:params
		     }); 
	     }
	      //查询结论复审
	     serv.getAuditResult = function(params){
	    	 return $http({
		    	  method: "get",
		    	  url:baseUrl+'hcpmsWarning/getAuditResult.do',
		    	  params:params
		     }); 
	     }
	     //查询通知单或告知单
	     serv.getWarnNotice = function(params){
	    	 return $http({
		    	  method: "get",
		    	  url:baseUrl+'hcpmsWarning/getWarnNotice.do',
		    	  params:params
		     }); 
	     }

	     //查询所有的扣分
	     serv.getPointAllData = function(params) {
	    	 return $http({
				url:baseUrl+'warningDeduction/findPointCutTemps.do',
				method:'GET',
				params : params
	    	 });
	     }
	     //基础数据
	     serv.getBaseFormParam = function(codeType) {
	    	 return $http({
				url:baseUrl+'hcpmsWarning/getBaseFormParam.do',
				method:'GET',
				params:{
		    		 codeType:codeType
		    	 }
	    	 });
	     }
	     //撤回操作
	     serv.backWarnProcess = function(param) {
	    	 return $http({
				url:baseUrl+'hcpmsWarning/backWarnProcess.do',
				method:'GET',
				params:param
	    	 });
	     }
	     //批量审核预警事件
	     serv.auditWarnBatchProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/auditWarnBatchProcess.do',params);
	     }
	     //批量反馈评估预警事件
	     serv.assessWarnBatchProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/assessWarnBatchProcess.do',params);
	     }
	     //批量提交预警事件
	     serv.addWarnBatchProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/submitWarnBatchProcess.do',params);
	     }
	     //批量结论审核预警事件	          
	     serv.resultAuditWarnBatchProcess = function(params){
	    	 return $http.post(baseUrl + 'hcpmsWarning/resultAuditWarnBatchProcess.do',params);
	     }
	     
	}]);
})();